using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter02
{
	/// <summary>
	/// Example08: Watch Out for the Speed Limit!
	/// A car traveling at a constant speed of 45.0 m/s passes 
	/// a trooper hidden behind a billboard. One second after 
	/// the speeding car passes the billboard, the trooper 
	/// sets out from the billboard to catch it, accelerating 
	/// at a constant rate of 3.00 m/s^2. 
	/// How long does it take her to overtake the car?
	/// </summary>
	public class Example08
	{
		public Example08()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
            Science.Mathematics.Calculus.PolynomialFunction p = new Science.Mathematics.Calculus.PolynomialFunction();
			p.MaximumPower = 2;
			p.Which = 0;
			p.Coefficient = 45.0;
			p.Which = 1;
			p.Coefficient = 45.0;
			p.Which = 2;
			p.Coefficient = -3.0/2.0;
			p.FindRoot();
			result += Convert.ToString(p.Root[0].Real)+"  +i "
				+ Convert.ToString(p.Root[0].Imaginary)+"\r\n";
			result += Convert.ToString(p.Root[1].Real)+"  +i "
				+ Convert.ToString(p.Root[1].Imaginary)+"\r\n";
		}
	}
}
